﻿Imports GalaSoft.MvvmLight
Imports GalaSoft.MvvmLight.Command
Imports Pronama.NicoVideo
Imports Pronama.NicoVideo.LiveStreaming
Imports System.Collections.ObjectModel

Namespace ViewModel

    Public Class AlertItemViewModel
        Inherits ViewModelBase

        Shared Property Helper As IHelper

        'Public Event OpenUri As EventHandler(Of OpenUriEventArgs)
        'Protected Sub OnOpenUri(ByVal uri As Uri)
        '    Dim e = New OpenUriEventArgs(uri)
        '    RaiseEvent OpenUri(Me, e)
        'End Sub

        Private _Id As String
        Property Id As String
            Get
                Return _Id
            End Get
            Set(ByVal value As String)
                If value <> _Id Then
                    _Id = value
                    RaisePropertyChanged("Id")
                End If
            End Set
        End Property


        Private _Title As String
        Property Title As String
            Get
                Return _Title
            End Get
            Set(ByVal value As String)
                If value <> _Title Then
                    _Title = value
                    RaisePropertyChanged("Title")
                End If
            End Set
        End Property

        Private _Description As String
        Property Description As String
            Get
                Return _Description
            End Get
            Set(ByVal value As String)
                If value <> _Description Then
                    _Description = value
                    RaisePropertyChanged("Description")
                End If
            End Set
        End Property


        Private _Uri As Uri
        Property Uri As Uri
            Get
                Return _Uri
            End Get
            Set(ByVal value As Uri)
                If value <> _Uri Then
                    _Uri = value
                    RaisePropertyChanged("Uri")
                End If
            End Set
        End Property

        Private _IconUri As Uri
        Property IconUri As Uri
            Get
                Return _IconUri
            End Get
            Set(ByVal value As Uri)
                If value <> _IconUri Then
                    _IconUri = value
                    RaisePropertyChanged("IconUri")
                End If
            End Set
        End Property

        Private _StationId As String
        Property StationId As String
            Get
                Return _StationId
            End Get
            Set(ByVal value As String)
                If value <> _StationId Then
                    _StationId = value
                    RaisePropertyChanged("StationId")
                End If
            End Set
        End Property

        Private _StationName As String
        Property StationName As String
            Get
                Return _StationName
            End Get
            Set(ByVal value As String)
                If value <> _StationName Then
                    _StationName = value
                    RaisePropertyChanged("StationName")
                End If
            End Set
        End Property

        Private _StationUri As Uri
        Property StationUri As Uri
            Get
                Return _StationUri
            End Get
            Set(ByVal value As Uri)
                If value <> _IconUri Then
                    _StationUri = value
                    RaisePropertyChanged("StationUri")
                End If
            End Set
        End Property

        Private _OpenUriCommand As ICommand
        Public ReadOnly Property OpenUriCommand As ICommand
            Get
                If _OpenUriCommand Is Nothing Then
                    _OpenUriCommand = New RelayCommand(Of Object)(AddressOf OpenUri)
                End If
                Return _OpenUriCommand
            End Get
        End Property

        Private Sub OpenUri(ByVal parameter As Object)
            If parameter Is Nothing Then
                Exit Sub
            End If

            Try
                AlertItemViewModel.Helper.OpenUri(DirectCast(parameter, Uri))
            Catch ex As Exception

            End Try
        End Sub

    End Class

End Namespace